<extend name="Public/base"/>

<!-- 子导航 -->
<block name="sidebar">
	<include file="sidemenu" />
</block>

<block name="body">


	<!-- 工具栏 -->
	<div class="product_headcut">
		<div class="cf">
			<!-- 高级搜索 -->
			<div class="search-form fr cf">
				<div class="sleft">
					<input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="商品ID/商品名称">
					<a class="sch-btn" href="javascript:;" id="search" url="{:U('article/index','pid='.I('pid',0).'&cate_id='.$cate_id,false)}"><i class="btn-search"></i></a>
				</div>
				<div class="btn-group-click adv-sch-pannel fl">
					<button class="btn">搜 索<i class="btn-arrowdown"></i></button>
					<div class="dropdown cf">
						<div class="row">
							<label>更新时间：</label>
							<input type="text" id="time-start" name="time-start" class="text input-2x" value="" placeholder="起始时间" /> -
							<input type="text" id="time-end" name="time-end" class="text input-2x" value="" placeholder="结束时间" />
						</div>
						<div class="row">
							<label>创建者：</label>
							<input type="text" name="nickname" class="text input-2x" value="" placeholder="请输入用户名">
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="add-product">
			<a href="/qgh/admin.php?s=/Article/add.html">新增</a>
		</div>
	</div>
	<hr class="product_hr"/>

	<!-- 数据表格 -->
	<div class="data-table">
		<table>
			<!-- 表头 -->
			<thead>
			<tr>
				<th class="row-selected row-selected">
					<input class="check-all" type="checkbox">
				</th>
				<volist name="list_grids" id="field">
					<th>{$field.title}</th>
				</volist>
				<th>商品ID</th>
				<th>商品名称</th>
				<th>售价</th>
				<th>库存</th>
				<th>销量</th>
				<th>操作</th>
			</tr>
			</thead>

			<!-- 列表 -->
			<tbody>

			<tr>
				<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
				<td>6</td>
				<td>这个是商品名称</td>
				<td>677</td>
				<td>762</td>
				<td>168</td>
				<td>
					<a>上架</a>&nbsp;
					<a>编辑</a>&nbsp;
					<a>删除</a>
				</td>
			</tr>
			<tr>
				<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
				<td>5</td>
				<td>这个是商品名称</td>
				<td>822</td>
				<td>176</td>
				<td>77</td>
				<td>
					<a>上架</a>&nbsp;
					<a>编辑</a>&nbsp;
					<a>删除</a>
				</td>
			</tr>
			<tr>
				<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
				<td>4</td>
				<td>这个是商品名称</td>
				<td>24</td>
				<td>442</td>
				<td>16</td>
				<td>
					<a>上架</a>&nbsp;
					<a>编辑</a>&nbsp;
					<a>删除</a>
				</td>
			</tr>
			<tr>
				<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
				<td>3</td>
				<td>这个是商品名称</td>
				<td>2434</td>
				<td>5443</td>
				<td>1554</td>
				<td>
					<a>上架</a>&nbsp;
					<a>编辑</a>&nbsp;
					<a>删除</a>
				</td>
			</tr>
			</tbody>
		</table>
		<aside class="paging">
			<a>第一页</a>
			<a>1</a>
			<a>2</a>
			<a>3</a>
			<a>…</a>
			<a>1004</a>
			<a>最后一页</a>
		</aside>
	</div>
	<!-- 分页 -->
	<div class="page">
		{$_page}
	</div>
	</div>

</block>
<block name="script">
	<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
	<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
	<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
	<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
	<script type="text/javascript">
		$(function(){
			//搜索功能
			$("#search").click(function(){
				var url = $(this).attr('url');
				var status = $("#sch-sort-txt").attr("data");
				var query  = $('.search-form').find('input').serialize();
				query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
				query = query.replace(/^&/g,'');
				if(status != ''){
					query = 'status=' + status + "&" + query;
				}
				if( url.indexOf('?')>0 ){
					url += '&' + query;
				}else{
					url += '?' + query;
				}
				window.location.href = url;
			});

			/* 状态搜索子菜单 */
			$(".search-form").find(".drop-down").hover(function(){
				$("#sub-sch-menu").removeClass("hidden");
			},function(){
				$("#sub-sch-menu").addClass("hidden");
			});
			$("#sub-sch-menu li").find("a").each(function(){
				$(this).click(function(){
					var text = $(this).text();
					$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
					$("#sub-sch-menu").addClass("hidden");
				})
			});

			//只有一个模型时，点击新增
			$('.document_add').click(function(){
				var url = $(this).attr('url');
				if(url != undefined && url != ''){
					window.location.href = url;
				}
			});

			//点击排序
			$('.list_sort').click(function(){
				var url = $(this).attr('url');
				var ids = $('.ids:checked');
				var param = '';
				if(ids.length > 0){
					var str = new Array();
					ids.each(function(){
						str.push($(this).val());
					});
					param = str.join(',');
				}

				if(url != undefined && url != ''){
					window.location.href = url + '/ids/' + param;
				}
			});

			//回车自动提交
			$('.search-form').find('input').keyup(function(event){
				if(event.keyCode===13){
					$("#search").click();
				}
			});

			$('#time-start').datetimepicker({
				format: 'yyyy-mm-dd',
				language:"zh-CN",
				minView:2,
				autoclose:true
			});

			$('#time-end').datetimepicker({
				format: 'yyyy-mm-dd',
				language:"zh-CN",
				minView:2,
				autoclose:true
			});
		})
	</script>
</block>
